package cn.ac.iscas.domain.component.transformer;


import cn.ac.iscas.domain.component.ComponentParameter;
import cn.ac.iscas.domain.view.ParameterItem;

import java.util.ArrayList;
import java.util.List;

public class TransformerParameter extends ComponentParameter implements ITransformerParameter {

    @Override
    public List<String> analyzeOutputColumn(List<String> columns) {
        if(columns == null ){
            columns = new ArrayList<>();
        }

        if(viewParams!=null){
            for(ParameterItem tmp : viewParams){
                if(tmp.isDelete()){
                    columns.remove(tmp.getId());
                }else if(tmp.isAdd()) {
                    columns.add(tmp.getValue().toString());
                }
            }
        }

        return columns;
    }
}
